﻿using System;

namespace dPet.Domain.Models
{
	using Hangerd;
	using Hangerd.Entity;

	public class ProductSubCategory : EntityBase
	{
		#region Public Properties

		/// <summary>
		/// 所属大类
		/// </summary>
		public virtual ProductCategory Category { get; private set; }


		private string _name;

		/// <summary>
		/// 小类名称
		/// </summary>
		[RecordModify]
		public string Name
		{
			get { return _name; }
			set
			{
				if (string.IsNullOrWhiteSpace(value))
				{
					throw new HangerdException("小类名称不可为空");
				}

				_name = value.Trim();
			}
		}

		/// <summary>
		/// 创建时间
		/// </summary>
		public DateTime CreateTime { get; private set; }

		#endregion

		#region Constructors

		private ProductSubCategory() { }

		public ProductSubCategory(ProductCategory category, string name)
		{
			this.Category = category;
			this.Name = name;
			this.CreateTime = DateTime.Now;
		}

		#endregion

		#region Public Methods

		#endregion
	}
}
